3.1.37 \(\int (f+g x)^2 (a+b \log (c (d+e x)^n)) \, dx\) [37]

3.1.37.1 Optimal result
3.1.37.2 Mathematica [A] (verified)
3.1.37.3 Rubi [A] (verified)
3.1.37.4 Maple [B] (verified)
3.1.37.5 Fricas [B] (verification not implemented)
3.1.37.6 Sympy [B] (verification not implemented)
3.1.37.7 Maxima [A] (verification not implemented)
3.1.37.8 Giac [B] (verification not implemented)
3.1.37.9 Mupad [B] (verification not implemented)

3.1.37.1 Optimal result

Integrand size = 22, antiderivative size = 120 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=-\frac {b (e f-d g)^2 n x}{3 e^2}-\frac {b (e f-d g) n (f+g x)^2}{6 e g}-\frac {b n (f+g x)^3}{9 g}-\frac {b (e f-d g)^3 n \log (d+e x)}{3 e^3 g}+\frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g} \]

output
-1/3*b*(-d*g+e*f)^2*n*x/e^2-1/6*b*(-d*g+e*f)*n*(g*x+f)^2/e/g-1/9*b*n*(g*x+ 
f)^3/g-1/3*b*(-d*g+e*f)^3*n*ln(e*x+d)/e^3/g+1/3*(g*x+f)^3*(a+b*ln(c*(e*x+d 
)^n))/g
 
3.1.37.2 Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.25 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=\frac {6 b d^2 g (-3 e f+d g) n \log (d+e x)+e \left (x \left (6 a e^2 \left (3 f^2+3 f g x+g^2 x^2\right )-b n \left (6 d^2 g^2-3 d e g (6 f+g x)+e^2 \left (18 f^2+9 f g x+2 g^2 x^2\right )\right )\right )+6 b e \left (3 d f^2+e x \left (3 f^2+3 f g x+g^2 x^2\right )\right ) \log \left (c (d+e x)^n\right )\right )}{18 e^3} \]

input
Integrate[(f + g*x)^2*(a + b*Log[c*(d + e*x)^n]),x]
 
output
(6*b*d^2*g*(-3*e*f + d*g)*n*Log[d + e*x] + e*(x*(6*a*e^2*(3*f^2 + 3*f*g*x 
+ g^2*x^2) - b*n*(6*d^2*g^2 - 3*d*e*g*(6*f + g*x) + e^2*(18*f^2 + 9*f*g*x 
+ 2*g^2*x^2))) + 6*b*e*(3*d*f^2 + e*x*(3*f^2 + 3*f*g*x + g^2*x^2))*Log[c*( 
d + e*x)^n]))/(18*e^3)
 
3.1.37.3 Rubi [A] (verified)

Time = 0.26 (sec) , antiderivative size = 112, normalized size of antiderivative = 0.93, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.136, Rules used = {2842, 49, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx\)

\(\Big \downarrow \) 2842

\(\displaystyle \frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac {b e n \int \frac {(f+g x)^3}{d+e x}dx}{3 g}\)

\(\Big \downarrow \) 49

\(\displaystyle \frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac {b e n \int \left (\frac {(e f-d g)^3}{e^3 (d+e x)}+\frac {g (e f-d g)^2}{e^3}+\frac {g (f+g x) (e f-d g)}{e^2}+\frac {g (f+g x)^2}{e}\right )dx}{3 g}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac {b e n \left (\frac {(e f-d g)^3 \log (d+e x)}{e^4}+\frac {g x (e f-d g)^2}{e^3}+\frac {(f+g x)^2 (e f-d g)}{2 e^2}+\frac {(f+g x)^3}{3 e}\right )}{3 g}\)

input
Int[(f + g*x)^2*(a + b*Log[c*(d + e*x)^n]),x]
 
output
-1/3*(b*e*n*((g*(e*f - d*g)^2*x)/e^3 + ((e*f - d*g)*(f + g*x)^2)/(2*e^2) + 
 (f + g*x)^3/(3*e) + ((e*f - d*g)^3*Log[d + e*x])/e^4))/g + ((f + g*x)^3*( 
a + b*Log[c*(d + e*x)^n]))/(3*g)
 

3.1.37.3.1 Defintions of rubi rules used

rule 49
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int 
[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n, x], x] /; FreeQ[{a, b, c, d}, x] 
&& IGtQ[m, 0] && IGtQ[m + n + 2, 0]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2842
Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))*((f_.) + (g_.)*(x_ 
))^(q_.), x_Symbol] :> Simp[(f + g*x)^(q + 1)*((a + b*Log[c*(d + e*x)^n])/( 
g*(q + 1))), x] - Simp[b*e*(n/(g*(q + 1)))   Int[(f + g*x)^(q + 1)/(d + e*x 
), x], x] /; FreeQ[{a, b, c, d, e, f, g, n, q}, x] && NeQ[e*f - d*g, 0] && 
NeQ[q, -1]
 
3.1.37.4 Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(264\) vs. \(2(110)=220\).

Time = 0.85 (sec) , antiderivative size = 265, normalized size of antiderivative = 2.21

method result size
parallelrisch \(\frac {6 x^{3} \ln \left (c \left (e x +d \right )^{n}\right ) b d \,e^{3} g^{2}-2 x^{3} b d \,e^{3} g^{2} n +6 x^{3} a d \,e^{3} g^{2}+18 x^{2} \ln \left (c \left (e x +d \right )^{n}\right ) b d \,e^{3} f g +3 x^{2} b \,d^{2} e^{2} g^{2} n -9 x^{2} b d \,e^{3} f g n +6 \ln \left (e x +d \right ) b \,d^{4} g^{2} n -18 \ln \left (e x +d \right ) b \,d^{3} e f g n +36 \ln \left (e x +d \right ) b \,d^{2} e^{2} f^{2} n +18 x^{2} a d \,e^{3} f g +18 x \ln \left (c \left (e x +d \right )^{n}\right ) b d \,e^{3} f^{2}-6 x b \,d^{3} e \,g^{2} n +18 x b \,d^{2} e^{2} f g n -18 x b d \,e^{3} f^{2} n +18 x a d \,e^{3} f^{2}-18 \ln \left (c \left (e x +d \right )^{n}\right ) b \,d^{2} e^{2} f^{2}}{18 d \,e^{3}}\) \(265\)
risch \(\frac {a \,g^{2} x^{3}}{3}+a \,f^{2} x -\frac {g^{2} b n \,x^{3}}{9}+g a f \,x^{2}+g \ln \left (c \right ) b f \,x^{2}-\frac {\ln \left (e x +d \right ) b \,f^{3} n}{3 g}-\frac {i g^{2} \pi b \,x^{3} \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{3}}{6}+\frac {\left (g x +f \right )^{3} b \ln \left (\left (e x +d \right )^{n}\right )}{3 g}+\frac {g^{2} b d n \,x^{2}}{6 e}-\frac {g b f n \,x^{2}}{2}-\frac {g^{2} b \,d^{2} n x}{3 e^{2}}+\frac {g^{2} \ln \left (e x +d \right ) b \,d^{3} n}{3 e^{3}}+\frac {i g^{2} \pi b \,x^{3} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{6}+\frac {i g^{2} \pi b \,x^{3} \operatorname {csgn}\left (i \left (e x +d \right )^{n}\right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{6}-\frac {i g \pi b f \,x^{2} \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{3}}{2}-b \,f^{2} n x +\frac {b \,f^{2} n d \ln \left (e x +d \right )}{e}-\frac {i \pi b \,f^{2} x \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{3}}{2}-\frac {i \pi b \,f^{2} x \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i \left (e x +d \right )^{n}\right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )}{2}-\frac {i g^{2} \pi b \,x^{3} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i \left (e x +d \right )^{n}\right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )}{6}+\frac {i g \pi b f \,x^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}+\frac {i g \pi b f \,x^{2} \operatorname {csgn}\left (i \left (e x +d \right )^{n}\right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}+\frac {g^{2} \ln \left (c \right ) b \,x^{3}}{3}+\ln \left (c \right ) b \,f^{2} x +\frac {i \pi b \,f^{2} x \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}+\frac {i \pi b \,f^{2} x \,\operatorname {csgn}\left (i \left (e x +d \right )^{n}\right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )^{2}}{2}+\frac {g b d f n x}{e}-\frac {g \ln \left (e x +d \right ) b \,d^{2} f n}{e^{2}}-\frac {i g \pi b f \,x^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i \left (e x +d \right )^{n}\right ) \operatorname {csgn}\left (i c \left (e x +d \right )^{n}\right )}{2}\) \(585\)

input
int((g*x+f)^2*(a+b*ln(c*(e*x+d)^n)),x,method=_RETURNVERBOSE)
 
output
1/18*(6*x^3*ln(c*(e*x+d)^n)*b*d*e^3*g^2-2*x^3*b*d*e^3*g^2*n+6*x^3*a*d*e^3* 
g^2+18*x^2*ln(c*(e*x+d)^n)*b*d*e^3*f*g+3*x^2*b*d^2*e^2*g^2*n-9*x^2*b*d*e^3 
*f*g*n+6*ln(e*x+d)*b*d^4*g^2*n-18*ln(e*x+d)*b*d^3*e*f*g*n+36*ln(e*x+d)*b*d 
^2*e^2*f^2*n+18*x^2*a*d*e^3*f*g+18*x*ln(c*(e*x+d)^n)*b*d*e^3*f^2-6*x*b*d^3 
*e*g^2*n+18*x*b*d^2*e^2*f*g*n-18*x*b*d*e^3*f^2*n+18*x*a*d*e^3*f^2-18*ln(c* 
(e*x+d)^n)*b*d^2*e^2*f^2)/d/e^3
 
3.1.37.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 221 vs. \(2 (110) = 220\).

Time = 0.29 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.84 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=-\frac {2 \, {\left (b e^{3} g^{2} n - 3 \, a e^{3} g^{2}\right )} x^{3} - 3 \, {\left (6 \, a e^{3} f g - {\left (3 \, b e^{3} f g - b d e^{2} g^{2}\right )} n\right )} x^{2} - 6 \, {\left (3 \, a e^{3} f^{2} - {\left (3 \, b e^{3} f^{2} - 3 \, b d e^{2} f g + b d^{2} e g^{2}\right )} n\right )} x - 6 \, {\left (b e^{3} g^{2} n x^{3} + 3 \, b e^{3} f g n x^{2} + 3 \, b e^{3} f^{2} n x + {\left (3 \, b d e^{2} f^{2} - 3 \, b d^{2} e f g + b d^{3} g^{2}\right )} n\right )} \log \left (e x + d\right ) - 6 \, {\left (b e^{3} g^{2} x^{3} + 3 \, b e^{3} f g x^{2} + 3 \, b e^{3} f^{2} x\right )} \log \left (c\right )}{18 \, e^{3}} \]

input
integrate((g*x+f)^2*(a+b*log(c*(e*x+d)^n)),x, algorithm="fricas")
 
output
-1/18*(2*(b*e^3*g^2*n - 3*a*e^3*g^2)*x^3 - 3*(6*a*e^3*f*g - (3*b*e^3*f*g - 
 b*d*e^2*g^2)*n)*x^2 - 6*(3*a*e^3*f^2 - (3*b*e^3*f^2 - 3*b*d*e^2*f*g + b*d 
^2*e*g^2)*n)*x - 6*(b*e^3*g^2*n*x^3 + 3*b*e^3*f*g*n*x^2 + 3*b*e^3*f^2*n*x 
+ (3*b*d*e^2*f^2 - 3*b*d^2*e*f*g + b*d^3*g^2)*n)*log(e*x + d) - 6*(b*e^3*g 
^2*x^3 + 3*b*e^3*f*g*x^2 + 3*b*e^3*f^2*x)*log(c))/e^3
 
3.1.37.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 252 vs. \(2 (102) = 204\).

Time = 0.66 (sec) , antiderivative size = 252, normalized size of antiderivative = 2.10 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=\begin {cases} a f^{2} x + a f g x^{2} + \frac {a g^{2} x^{3}}{3} + \frac {b d^{3} g^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{3 e^{3}} - \frac {b d^{2} f g \log {\left (c \left (d + e x\right )^{n} \right )}}{e^{2}} - \frac {b d^{2} g^{2} n x}{3 e^{2}} + \frac {b d f^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + \frac {b d f g n x}{e} + \frac {b d g^{2} n x^{2}}{6 e} - b f^{2} n x + b f^{2} x \log {\left (c \left (d + e x\right )^{n} \right )} - \frac {b f g n x^{2}}{2} + b f g x^{2} \log {\left (c \left (d + e x\right )^{n} \right )} - \frac {b g^{2} n x^{3}}{9} + \frac {b g^{2} x^{3} \log {\left (c \left (d + e x\right )^{n} \right )}}{3} & \text {for}\: e \neq 0 \\\left (a + b \log {\left (c d^{n} \right )}\right ) \left (f^{2} x + f g x^{2} + \frac {g^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \]

input
integrate((g*x+f)**2*(a+b*ln(c*(e*x+d)**n)),x)
 
output
Piecewise((a*f**2*x + a*f*g*x**2 + a*g**2*x**3/3 + b*d**3*g**2*log(c*(d + 
e*x)**n)/(3*e**3) - b*d**2*f*g*log(c*(d + e*x)**n)/e**2 - b*d**2*g**2*n*x/ 
(3*e**2) + b*d*f**2*log(c*(d + e*x)**n)/e + b*d*f*g*n*x/e + b*d*g**2*n*x** 
2/(6*e) - b*f**2*n*x + b*f**2*x*log(c*(d + e*x)**n) - b*f*g*n*x**2/2 + b*f 
*g*x**2*log(c*(d + e*x)**n) - b*g**2*n*x**3/9 + b*g**2*x**3*log(c*(d + e*x 
)**n)/3, Ne(e, 0)), ((a + b*log(c*d**n))*(f**2*x + f*g*x**2 + g**2*x**3/3) 
, True))
 
3.1.37.7 Maxima [A] (verification not implemented)

Time = 0.21 (sec) , antiderivative size = 187, normalized size of antiderivative = 1.56 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=\frac {1}{3} \, b g^{2} x^{3} \log \left ({\left (e x + d\right )}^{n} c\right ) + \frac {1}{3} \, a g^{2} x^{3} - b e f^{2} n {\left (\frac {x}{e} - \frac {d \log \left (e x + d\right )}{e^{2}}\right )} + \frac {1}{18} \, b e g^{2} n {\left (\frac {6 \, d^{3} \log \left (e x + d\right )}{e^{4}} - \frac {2 \, e^{2} x^{3} - 3 \, d e x^{2} + 6 \, d^{2} x}{e^{3}}\right )} - \frac {1}{2} \, b e f g n {\left (\frac {2 \, d^{2} \log \left (e x + d\right )}{e^{3}} + \frac {e x^{2} - 2 \, d x}{e^{2}}\right )} + b f g x^{2} \log \left ({\left (e x + d\right )}^{n} c\right ) + a f g x^{2} + b f^{2} x \log \left ({\left (e x + d\right )}^{n} c\right ) + a f^{2} x \]

input
integrate((g*x+f)^2*(a+b*log(c*(e*x+d)^n)),x, algorithm="maxima")
 
output
1/3*b*g^2*x^3*log((e*x + d)^n*c) + 1/3*a*g^2*x^3 - b*e*f^2*n*(x/e - d*log( 
e*x + d)/e^2) + 1/18*b*e*g^2*n*(6*d^3*log(e*x + d)/e^4 - (2*e^2*x^3 - 3*d* 
e*x^2 + 6*d^2*x)/e^3) - 1/2*b*e*f*g*n*(2*d^2*log(e*x + d)/e^3 + (e*x^2 - 2 
*d*x)/e^2) + b*f*g*x^2*log((e*x + d)^n*c) + a*f*g*x^2 + b*f^2*x*log((e*x + 
 d)^n*c) + a*f^2*x
 
3.1.37.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 424 vs. \(2 (110) = 220\).

Time = 0.31 (sec) , antiderivative size = 424, normalized size of antiderivative = 3.53 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=\frac {{\left (e x + d\right )} b f^{2} n \log \left (e x + d\right )}{e} + \frac {{\left (e x + d\right )}^{2} b f g n \log \left (e x + d\right )}{e^{2}} - \frac {2 \, {\left (e x + d\right )} b d f g n \log \left (e x + d\right )}{e^{2}} + \frac {{\left (e x + d\right )}^{3} b g^{2} n \log \left (e x + d\right )}{3 \, e^{3}} - \frac {{\left (e x + d\right )}^{2} b d g^{2} n \log \left (e x + d\right )}{e^{3}} + \frac {{\left (e x + d\right )} b d^{2} g^{2} n \log \left (e x + d\right )}{e^{3}} - \frac {{\left (e x + d\right )} b f^{2} n}{e} - \frac {{\left (e x + d\right )}^{2} b f g n}{2 \, e^{2}} + \frac {2 \, {\left (e x + d\right )} b d f g n}{e^{2}} - \frac {{\left (e x + d\right )}^{3} b g^{2} n}{9 \, e^{3}} + \frac {{\left (e x + d\right )}^{2} b d g^{2} n}{2 \, e^{3}} - \frac {{\left (e x + d\right )} b d^{2} g^{2} n}{e^{3}} + \frac {{\left (e x + d\right )} b f^{2} \log \left (c\right )}{e} + \frac {{\left (e x + d\right )}^{2} b f g \log \left (c\right )}{e^{2}} - \frac {2 \, {\left (e x + d\right )} b d f g \log \left (c\right )}{e^{2}} + \frac {{\left (e x + d\right )}^{3} b g^{2} \log \left (c\right )}{3 \, e^{3}} - \frac {{\left (e x + d\right )}^{2} b d g^{2} \log \left (c\right )}{e^{3}} + \frac {{\left (e x + d\right )} b d^{2} g^{2} \log \left (c\right )}{e^{3}} + \frac {{\left (e x + d\right )} a f^{2}}{e} + \frac {{\left (e x + d\right )}^{2} a f g}{e^{2}} - \frac {2 \, {\left (e x + d\right )} a d f g}{e^{2}} + \frac {{\left (e x + d\right )}^{3} a g^{2}}{3 \, e^{3}} - \frac {{\left (e x + d\right )}^{2} a d g^{2}}{e^{3}} + \frac {{\left (e x + d\right )} a d^{2} g^{2}}{e^{3}} \]

input
integrate((g*x+f)^2*(a+b*log(c*(e*x+d)^n)),x, algorithm="giac")
 
output
(e*x + d)*b*f^2*n*log(e*x + d)/e + (e*x + d)^2*b*f*g*n*log(e*x + d)/e^2 - 
2*(e*x + d)*b*d*f*g*n*log(e*x + d)/e^2 + 1/3*(e*x + d)^3*b*g^2*n*log(e*x + 
 d)/e^3 - (e*x + d)^2*b*d*g^2*n*log(e*x + d)/e^3 + (e*x + d)*b*d^2*g^2*n*l 
og(e*x + d)/e^3 - (e*x + d)*b*f^2*n/e - 1/2*(e*x + d)^2*b*f*g*n/e^2 + 2*(e 
*x + d)*b*d*f*g*n/e^2 - 1/9*(e*x + d)^3*b*g^2*n/e^3 + 1/2*(e*x + d)^2*b*d* 
g^2*n/e^3 - (e*x + d)*b*d^2*g^2*n/e^3 + (e*x + d)*b*f^2*log(c)/e + (e*x + 
d)^2*b*f*g*log(c)/e^2 - 2*(e*x + d)*b*d*f*g*log(c)/e^2 + 1/3*(e*x + d)^3*b 
*g^2*log(c)/e^3 - (e*x + d)^2*b*d*g^2*log(c)/e^3 + (e*x + d)*b*d^2*g^2*log 
(c)/e^3 + (e*x + d)*a*f^2/e + (e*x + d)^2*a*f*g/e^2 - 2*(e*x + d)*a*d*f*g/ 
e^2 + 1/3*(e*x + d)^3*a*g^2/e^3 - (e*x + d)^2*a*d*g^2/e^3 + (e*x + d)*a*d^ 
2*g^2/e^3
 
3.1.37.9 Mupad [B] (verification not implemented)

Time = 0.84 (sec) , antiderivative size = 212, normalized size of antiderivative = 1.77 \[ \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx=x^2\,\left (\frac {g\,\left (a\,d\,g+2\,a\,e\,f-b\,e\,f\,n\right )}{2\,e}-\frac {d\,g^2\,\left (3\,a-b\,n\right )}{6\,e}\right )+x\,\left (\frac {3\,a\,e\,f^2-3\,b\,e\,f^2\,n+6\,a\,d\,f\,g}{3\,e}-\frac {d\,\left (\frac {g\,\left (a\,d\,g+2\,a\,e\,f-b\,e\,f\,n\right )}{e}-\frac {d\,g^2\,\left (3\,a-b\,n\right )}{3\,e}\right )}{e}\right )+\ln \left (c\,{\left (d+e\,x\right )}^n\right )\,\left (b\,f^2\,x+b\,f\,g\,x^2+\frac {b\,g^2\,x^3}{3}\right )+\frac {g^2\,x^3\,\left (3\,a-b\,n\right )}{9}+\frac {\ln \left (d+e\,x\right )\,\left (b\,n\,d^3\,g^2-3\,b\,n\,d^2\,e\,f\,g+3\,b\,n\,d\,e^2\,f^2\right )}{3\,e^3} \]

input
int((f + g*x)^2*(a + b*log(c*(d + e*x)^n)),x)
 
output
x^2*((g*(a*d*g + 2*a*e*f - b*e*f*n))/(2*e) - (d*g^2*(3*a - b*n))/(6*e)) + 
x*((3*a*e*f^2 - 3*b*e*f^2*n + 6*a*d*f*g)/(3*e) - (d*((g*(a*d*g + 2*a*e*f - 
 b*e*f*n))/e - (d*g^2*(3*a - b*n))/(3*e)))/e) + log(c*(d + e*x)^n)*((b*g^2 
*x^3)/3 + b*f^2*x + b*f*g*x^2) + (g^2*x^3*(3*a - b*n))/9 + (log(d + e*x)*( 
b*d^3*g^2*n + 3*b*d*e^2*f^2*n - 3*b*d^2*e*f*g*n))/(3*e^3)